from django.urls import path
from apps.wthg_admin.views.orders import OrderInfoListUpdateAPIView, OrderGoodsRetrieveAPIView,OrderInfoUpdateAPIView
from apps.wthg_admin.utils import AdminTokenObtainPairView
from apps.wthg_admin.views import home,user
from apps.wthg_admin.views.images import SKUListAPIView
from apps.wthg_admin.views.sku import GoodsCategoryListAPIView,GoodsSPUListAPIView,SpecsListAPIView
from apps.wthg_admin.views.permission import ContentTypeListAPIView
from apps.wthg_admin.views import group,admin,spu
from apps.wthg_admin.views.specs_options import SPUSpecificationListAPIView
from apps.wthg_admin.views import channel

urlpatterns = [
    # path('authorizations/',MyUserLoginObtainJSONWebToken.as_view())
    path('authorizations/',AdminTokenObtainPairView.as_view()), #用户登录
    path('statistical/day_active/',home.UserDailyActiveCountView.as_view()), #日活跃用户统计
    path('statistical/day_orders/',home.UserDailyOrderCountView.as_view()), #日下单用户量统计
    path('statistical/total_count/',home.TotalUserStatisticsView.as_view()), #用户总量统计
    path('statistical/day_increment/',home.DailyUserStatisticsView.as_view()), #日增用户统计
    path('statistical/month_increment/',home.MonthlyUserStatistics.as_view()), #月增用户统计
    path('statistical/goods_day_views/',home.ProductVisitsView.as_view()), #商品访问量


    path('users/',user.UserAPIView.as_view()), #用户管理

    path('skus/simple/',SKUListAPIView.as_view()), #新增图片查询sku_id

    path('skus/categories/',GoodsCategoryListAPIView.as_view()), #获取三级分类信息

    path('goods/simple/',GoodsSPUListAPIView.as_view()), #获取SPU表名称数据

    path('goods/<pk>/specs/',SpecsListAPIView.as_view()), #获取SPU商品规格信息

    path('permission/content_types/',ContentTypeListAPIView.as_view()), #权限类型表查询

    path('permission/simple/',group.PermissionListAPIView.as_view()), #权限类型表查询

    path('permission/groups/simple/',admin.GroupListAPIView.as_view()), #权限组表查询

    path('orders/',OrderInfoListUpdateAPIView.as_view()), ##订单管理

    path('orders/<pk>/',OrderGoodsRetrieveAPIView.as_view()), ##订获取订单详情数据

    path('orders/<order_id>/status/',OrderInfoUpdateAPIView.as_view()), ##更新订单状态

    path('goods/brands/simple/',spu.BrandListAPIView.as_view()), ##获取品牌名称

    path('goods/channel/categories/',spu.GoodsCategory_1ListAPIView.as_view()), ##获得一级分类

    path('goods/channel/categories/<pk>/',spu.GoodsCategory_2_3ListAPIView.as_view()), ##获得二，三级分类

    path('goods/specs/simple/',SPUSpecificationListAPIView.as_view()), ##获得规格选项列表

    path('goods/categories/',channel.GoodsCategoryListAPIView.as_view()), ##商品一级分类展示

    path('goods/channel_types/',channel.GoodsChannelGroupListAPIView.as_view()), ##频道组展示








]

#图片管理url生成
from rest_framework import routers
from apps.wthg_admin.views import images
router=routers.DefaultRouter()
router.register('skus/images',images.SKUImageModelViewSet,basename='image')
#sku管理url生成
from apps.wthg_admin.views.sku import SKUModelViewSet
router.register('skus',SKUModelViewSet,basename='sku')
#权限表管理
from apps.wthg_admin.views.permission import PermissionModelViewSet
router.register('permission/perms',PermissionModelViewSet,'perms')
#组权限表管理
from apps.wthg_admin.views.group import GroupModelViewSet
router.register('permission/groups',GroupModelViewSet,'group')
#管理员管理
from apps.wthg_admin.views.admin import AdminUserModelViewSet
router.register('permission/admins',AdminUserModelViewSet,'adminUser')
#规格表管理
from apps.wthg_admin.views.specs import SPUSpecificationModelViewSet
router.register('goods/specs',SPUSpecificationModelViewSet,'specs')
#品牌管理
from apps.wthg_admin.views.brand import BrandModelViewSet
router.register('goods/brands',BrandModelViewSet,'brand')
#商品频道管理
from apps.wthg_admin.views.channel import GoodsChannelModelViewSet
router.register('goods/channels',GoodsChannelModelViewSet,'channels')
#SPU管理
from apps.wthg_admin.views.spu import SPUModelViewSet
router.register('goods',SPUModelViewSet,'goods')
#规格选项表管理
from apps.wthg_admin.views.specs_options import SpecificationOptionModelViewSet
router.register('specs/options',SpecificationOptionModelViewSet,'options')



urlpatterns+=router.urls
